-
Notifications
You must be signed in to change notification settings - Fork 417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make _stable_1d_sort(nb)
optional
#196
Conversation
Codecov Report
@@ Coverage Diff @@
## master #196 +/- ##
===========================================
- Coverage 96.63% 79.86% -16.77%
===========================================
Files 180 90 -90
Lines 5760 2871 -2889
===========================================
- Hits 5566 2293 -3273
- Misses 194 578 +384
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
if n < nb: | ||
x_max = x.max() | ||
x = torch.cat([x, (x_max + 1) * torch.ones(nb - n, dtype=x.dtype, device=x.device)], 0) | ||
if nb is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO we should just remove nb
option. I don't see when you'd ever want it to be anything other than 2049
. The padding is just a hack to get torch to sort the array in a stable manner (look at the docstring).
|
||
|
||
@pytest.mark.parametrize("nb", (None, 5, 15)) | ||
def test_stable_1d_sort(nb): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in your test, you are actually not testing stability at all, you are just testing if the sort is working at all. Can you try seeing if sorting an array of 8 zeros (and other equal values) produces indices=[0,1,2,3,..7] (so no changes are made by sort, meaning it's stable)
@carmocca I think this won't be needed after merging #197 (comment) |
Before submitting
What does this PR do?
Fixes #195